﻿using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MongoDB.Bson;
using System.Data.Linq;

namespace MvcOSGi.Shell.Version
{
    public class Version
    {
        public int CID { get; set; }
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int VersionID { get; set; }
        public string VersionName { get; set; }
        public List<Page> Pages { get; set; }
        public string VersionHTML { get; set; }
        public List<Include> FileIncludes { get; set; }
        public List<Plugin> GlobalPlugins { get; set; }
        public string VersionPath { get; set; }
        public bool IsDefault { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Page
    {
        public int CID { get; set; }
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int PageID { get; set; }
        public string PageName { get; set; }
        public string VersionHTML { get; set; }
        public List<Plugin> Plugins { get; set; }
        public List<Include> FileIncludes { get; set; }
        public bool IsActive { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Plugin
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public int PluginID { get; set; }
        public string PluginName { get; set; }
        public List<int> PageIDs { get; set; }
        public string Mode { get; set; }
        public List<Mode> Modes { get; set; }
        public bool IsActive { get; set; }
        public int SortOrder { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Include
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public string FileName { get; set; }
        public string Type { get; set; }
        public int SortOrder { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime CreatedDate { get; set; }
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifiedDate { get; set; }
    }

    public class Mode
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string _id { get; set; }
        public string ModeName { get; set; }
        public List<Property> ModeProperties { get; set; }
        public bool IsActive { get; set; }
    }

    public class Property
    {
        public string PropertyName { get; set; }
        public string Key { get; set; }
        public string Value { get; set; }
    }
}